﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RaytracerLib.MathLib;
using System.Drawing;
using YAXLib;

namespace RaytracerLib.Samplers
{
    public class HaltonSampler : LowDiscrepancySequenceSampler
    {
        protected int m_n = 1;

        [YAXNode]
        public int BaseX = 2;

        [YAXNode]
        public int BaseY = 3;

        protected override Vector2 NextSample()
        {
            int n = m_n;
            m_n++;

            return new Vector2(
                LowDiscrepancyMath.RadicalInverse(n, BaseX),
                LowDiscrepancyMath.RadicalInverse(n, BaseY));
        }

        public override SamplerType SamplerType
        {
            get
            {
                return SamplerType.Halton;
            }
        }
    }
}
